var async = require('async');
var mysql = require('../dbs/mysql').connection;
exports.index = function(req, res, next){
  async.auto({
    newsList : function(callback){
      var sql = 'SELECT id,title,thumb,newsdesc FROM news ORDER BY createtime DESC limit 10';
      mysql.query(sql, function(err, results){
        if(err){
            callback(null, { })
        }else{
            callback(null, results)
        }
      })
    }
  },function(e, results){
    res.render('index2',{
      "results":results
    });
  })
}